<?
require("config.php");

$location_status .= " | Edit";

$show_backnav = "menu";

require($rela_path . "bin/country.php");

$menutype = 2;

if (NULL!=$action){

   $field = array(
	"code",
	"name",
	"status",
	"publish_date",
	"details",
	"order_index",
	"site_title",
	"site_description",
	"site_keywords",
	"type",
	);


   $content = array(
	$Code,
	$Name,
	$Status,
	"$myYear-$myMonth-$myDay",
	$Details,
	$Order_index,

	$Site_title,
	$Site_description,
	$Site_keywords, $type
	);

   $exp = "id='$id'";

   myUpdate($table,$field,$content,$exp);

   if ($Name!==$old_Name){

   $field = array(
	"course",
	);


   $content = array(
	$Name,
	);

   $exp = "course='$old_Name'";

   myUpdate("course_schedule",$field,$content,$exp);
   myUpdate("course_enrollment",$field,$content,$exp);
   myUpdate("course_sharing",$field,$content,$exp);



   }


   header("location:" . $rela_path . "share/msg.php?v=702&Start_Num=" . $Start_Num);

   exit();

}


$Query = "select 
	code,
	name,
	status,
	publish_date,
	details,
	order_index,
	site_title,
	site_description,
	site_keywords, type 
from $table where id='$id' Limit 1";
$r = myQuery($Query);

	$Code=		$r[0][0];
	$Name=	eregi_replace("&", "&amp;", $r[0][1]);
	$Status=	$r[0][2];
	$Publish_date=	$r[0][3];
	$Details=	eregi_replace("&", "&amp;", $r[0][4]);
	$Order_index= $r[0][5];

	$Site_title= $r[0][6];
	$Site_description= $r[0][7];
	$Site_keywords= $r[0][8];
	$type = $r[0][9];

require($rela_path . "inc/header.php");
require($rela_path . "bin/date.php");

?>

<form name="form1" method="post" action="">
<!--hidden filed-->
<input name="action" type="hidden" value="edit">
<input name="Code" type="hidden" value="<?print($Code)?>">
<input name="old_Name" type="hidden" value="<?print($Name)?>">

  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right"> <input name="image" type="image" onclick="Redirect('menu.php',1);return false;" src="../../images/bt_cancel.gif" width="78" height="23"> 
        <input name="image" type="image" src="../../images/bt_save.gif" width="76" height="22"  <?print($active)?>> 
      </td>
    </tr>
  </table>
  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right">&nbsp; </td>
    </tr>
    <tr> 
      <td><table border="0">

<!--
          <tr>
            <td>&nbsp;</td>
            <td><div align="right"><a href="../schedule/menu.php?label=<?=$Name?>">Schedule</a> | <a href="../sharing/menu.php?label=<?=$Name?>">Graduate's 
                Sharing</a></div></td>
          </tr>
-->



          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td class="tdheader">Code :</td>
            <td> <input class="text" type="text" name="Code" value="<?print($Code)?>" DISABLED> 
            </td>
          </tr>

          <tr> 
            <td class="tdheader">Order : </td>
            <td><input type="text" class="text" name="Order_index" size="12" value="<?print($Order_index)?>"></td>
          </tr>
          <tr> 
            <td class="tdheader">Name :</td>
            <td> <textarea class="text" name="Name" cols="60" rows="3"><?print($Name)?></textarea> 
            </td>
          </tr>
          <tr>
            <td class="tdheader">Type :</td>
            <td>
              <select name="type" class="select">
                <option value="1" <?php if ($type == 1) { echo "selected"; } ?>>Evening Seminars</option>
                <option value="2" <?php if ($type == 2) { echo "selected"; } ?>>Training Courses</option>
                <option value="3" <?php if ($type == 3) { echo "selected"; } ?>>Training Programs</option>
                <option value="4" <?php if ($type == 4) { echo "selected"; } ?>>In-house Training</option>
              </select>
            </td>
          </tr>
          <tr> 
            <td valign="top" class="tdheader">Publish :</td>
            <td> 
              <?

$sourceData = array(
  "Yes",
  "No",
  );

$boxName="Status";

FFPCheckBox("Status",$Status,$sourceData,$sourceLabel);

?>
            </td>
          </tr>
          <tr> 
            <td class="tdheader">Publishing Date :</td>
            <td><?print(FFPtime($Publish_date))?></td>
          </tr>


          <tr> 
            <td class="tdheader">Details :</td>
            <td> <textarea class="text" name="Details" cols="60" rows="30"><?print($Details)?></textarea> 
            </td>
          </tr>

          <tr> 
            <td class="tdheader">Site Title :</td>
            <td> <input type="text" class="text" name="Site_title" size="60" value="<?print($Site_title)?>">
            </td>
          </tr>

          <tr> 
            <td class="tdheader">Site Description :</td>
            <td> <textarea class="text" name="Site_description" cols="60" rows="6"><?print($Site_description)?></textarea> 
            </td>
          </tr>


          <tr> 
            <td class="tdheader">Site keywords :</td>
            <td> <textarea class="text" name="Site_keywords" cols="60" rows="6"><?print($Site_keywords)?></textarea> 
            </td>
          </tr>


          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
  </table>
  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right"> <input name="image2" type="image" onclick="Redirect('menu.php',1);return false;" src="../../images/bt_cancel.gif" width="78" height="23"> 
        <input name="image2" type="image" src="../../images/bt_save.gif" width="76" height="22" <?print($active)?>> 
      </td>
    </tr>
  </table>
</form>
<?
require($rela_path . "inc/footer.php");
?>

